package com.t.bricks.bussiness.db.mapper.customergoldroll;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.t.bricks.bussiness.db.entity.customergoldroll.base.CustomerAccountBase;

@Mapper
public interface CustomerGoldRollMapper {
	
	/**
	 * 领取代金卷
	 * @param sGoldRollNo
	 * @param sCustomerId
	 * @return
	 */
	int employ(
		@Param("sGoldRollNo") String sGoldRollNo,
		@Param("sCustomerId") String sCustomerId
	);
	
	/**
	 * 判断是否已经领取这个代金卷
	 * @param sGoldRollNo
	 * @param sCustomerId
	 * @return
	 */
	int hasGoldRoll(
		@Param("sGoldRollNo") String sGoldRollNo,
		@Param("sCustomerId") String sCustomerId
	);
	
	/**
	 * 减少代金卷剩余数量
	 * 注意:操作 GoldRoll 表
	 * @param sNo
	 * @param iCount
	 * @return
	 */
	int decGoldRollSurpCount(
		@Param("sNo") String sNo,
		@Param("iCount") int iCount
	);

	/**
	 * 查询顾客账户
	 * @param sId
	 * @return
	 */
	CustomerAccountBase findCustomer(@Param("sId") String sId);
	
	/**
	 * 更新顾客账户中的余额与积分
	 * @param customerAccountBase
	 * @return
	 */
	int changeCustomerAccount(CustomerAccountBase customerAccountBase);
	
//	/**
//	 * 新增积分记录数据
//	 * @param tallyBase
//	 * @return
//	 */
//	int addTally(TallyBase tallyBase);
	
}
